package com.yycx.module.bus.provider.handler.process.listener;

import com.yycx.common.constants.CommonConstants;
import com.yycx.module.bus.client.entity.BusPayment;
import com.yycx.module.bus.provider.service.BusPaymentService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 市场保证金审批结束监听器
 *
 * @author zyf
 */
@Component
public class CustomBondProcessEndListener implements ExecutionListener {

    @Autowired
    private BusPaymentService paymentService;


    @Override
    public void notify(DelegateExecution delegateExecution) {
        String businessKey = delegateExecution.getProcessInstanceBusinessKey();
        BusPayment payment = paymentService.getById(businessKey);
        //更新为已审批状态
        paymentService.updatePaymentState(payment.getPaymentId(), CommonConstants.INT_2);
    }
}
